package com.weixin.paleituo.item;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.baozi.treerecyclerview.base.ViewHolder;
import com.baozi.treerecyclerview.factory.ItemHelperFactory;
import com.baozi.treerecyclerview.item.TreeItem;
import com.baozi.treerecyclerview.item.TreeSelectItemGroup;
import com.weixin.paleituo.R;
import com.weixin.paleituo.bean.FirstOrderListBean;
import com.weixin.paleituo.bean.GoodsListBeans;

import java.util.List;

/**
 * Created by a123 on 2018/6/5.
 */

public class CartGroupItem extends TreeSelectItemGroup<FirstOrderListBean> {

    @Override
    public int getLayoutId() {
        return R.layout.item_after_sale_request_one;
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder viewHolder) {
      //  viewHolder.setChecked(R.id.cb_ischeck, isChildCheck());

        FirstOrderListBean data = getData();
        TextView tvOrderBean = viewHolder.getTextView(R.id.tv_ordernumber_item_after_sale_request_one);
        TextView tvOrderTime = viewHolder.getTextView(R.id.tv_ordertime_item_after_sale_request_one);
        tvOrderBean.setText("订单编号:"+data.getOrderDetailNum());
        tvOrderTime.setText("下单时间:"+data.getCreateTime());

        //订单编号：77265180174







       /* if (isExpand()){
            //展开
        }else{
            //折叠
        }*/
    }

    @Nullable
    @Override
    protected List<TreeItem> initChildList(FirstOrderListBean data) {
      //  String[] strings = {"1", "1", "1", "1"};//假数据
        //List<String> childs = Arrays.asList(strings);
        List<GoodsListBeans> goodsList = data.getGoodsList();
        return ItemHelperFactory.createTreeItemList(goodsList, CartItem.class, this);
    }

    @Override
    public void onClick(ViewHolder viewHolder) {
        super.onClick(viewHolder);
        selectAll(!isSelectAll());
        getItemManager().notifyDataChanged();

    }
}
